package com.wc.AlgoOJ_train.train1.c1.A107;

import java.util.HashSet;
import java.util.Scanner;

/**
 * @Author congge
 * @Date 2023/12/26 10:06
 * 人见人爱A-B
 * http://43.138.190.70:8888/p/A107
 * @description
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextInt()) {
            int n = sc.nextInt();
            int m = sc.nextInt();
            if (n == 0 && m == 0) {
                break;
            }
            int[] arr = new int[n];
            HashSet<Integer> B = new HashSet<>();
            HashSet<Integer> A = new HashSet<>();
            for (int i = 0; i < n; i++) {
                arr[i] = sc.nextInt();
                A.add(arr[i]);
            }
            for (int i = 0; i < m; i++) {
                B.add(sc.nextInt());
            }

            for (int i = 0; i < n; i++) {
                if (B.contains(arr[i])) {
                    A.remove(arr[i]);
                }
            }
            if (A.isEmpty()) {
                System.out.println("NULL");
            } else {
                for (int i = 0; i < n; i++) {
                    if (A.contains(arr[i])) {
                        System.out.print(arr[i] + " ");
                    }
                }
                System.out.println();
            }
        }
    }
}
